package com.wanter.paper.controller;

import com.wanter.paper.entity.Mould;
import com.wanter.paper.service.MouldService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * controller
 * Created by er on 17-7-16.
 */
@Controller
@RequestMapping("/mouleAction/")
public class MouldController {
    @Autowired
    private MouldService mouldService;
    private final Logger logger = Logger.getLogger(this.getClass());

    /**
     * 拿到全部的题的类型
     *
     * @return lists
     */
    @ResponseBody
    @RequestMapping("getMoulds")
    public List<Mould> getParentsmoulds() {

        List<Mould> lists = mouldService.geParentMoulds();
        if (logger.isInfoEnabled()) {
            logger.info("返回到前段的集合为" + lists);
        }
        if (lists != null && lists.size() > 0) {
            return lists;
        } else {
            return new ArrayList<>(0);
        }
    }


}
